<?php
class Blogger_Posts_Comments extends Blogger_Db_Table_Abstract
{
	protected $_name = 'posts_comments';
	protected $_primary = 'id';
	
	public function postComment($postId, $text, $userId)
	{
		$postId = (int)$postId;
		$text = addslashes($text);
		$userId = (int)$userId;
		$this->insert(array('posts_id' => $postId,
							'users_id' => $userId,
							'contentText' => $text,
							));
	}
	
	public function deleteComment($commentId)
	{
		$commentId = (int)$commentId;
		if(1 != $this->delete("id = $commentId"))
			throw new Blogger_Exception("None or more than 1 record deleted for commentId = $commentId", Blogger_Exception_Codes::ERROR_CRITICAL);
	}
}